package com.cskaoyan.controller;

import com.cskaoyan.bean.JsonUser;
import com.cskaoyan.vo.BaseRespVo;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author stone
 * @date 2022/10/07 14:50
 */
@RestController
public class JsonController {

    @RequestMapping("user/login")
    public BaseRespVo login1(@RequestBody String json) throws JsonProcessingException {
        //JsonUser jsonUser = new ObjectMapper().readValue(json, JsonUser.class);
        return BaseRespVo.ok();
    }

    @RequestMapping("user/login2")
    public BaseRespVo login2(@RequestBody JsonUser user) {
        return BaseRespVo.ok();
    }

    @RequestMapping("user/login3")
    public BaseRespVo login3(@RequestBody Map map) {
        return BaseRespVo.ok();
    }
}
